package top.zk123.chain.service;

import org.springframework.web.multipart.MultipartFile;
import top.zk123.chain.bean.Institution;
import top.zk123.chain.bean.ReturnInfo;
import top.zk123.chain.exception.FileEmptyException;
import top.zk123.chain.exception.FileUploadException;
import top.zk123.chain.exception.RegisterFailedException;
import top.zk123.chain.exception.WrongFileTypeException;

/**
 * 机构相关 业务逻辑层
 *
 * @author Ke Zhang
 * @since 1.0
 */
public interface InstitutionService {

    /**
     * 机构登录
     *
     * @param institution 机构
     * @return ReturnInfo
     */
    ReturnInfo login(Institution institution);

    /**
     * 机构注册
     *
     * @param username 用户名
     * @param pwd      密码
     * @param nickname 机构名称
     * @param avatar   机构头像
     * @param proof    凭证
     * @return ReturnInfo
     * @throws FileUploadException     文件上传失败
     * @throws WrongFileTypeException  不支持的文件类型
     * @throws FileEmptyException      文件为空
     * @throws RegisterFailedException 注册失败
     */
    ReturnInfo register(String username, String pwd, String nickname, MultipartFile avatar, MultipartFile[] proof) throws FileUploadException, WrongFileTypeException, FileEmptyException, RegisterFailedException;

    /**
     * 设置昵称
     *
     * @param nickname 昵称
     * @return ReturnInfo
     */
    ReturnInfo setNickname(String nickname);

    /**
     * 设置头像
     *
     * @param multipartFile 图片
     * @return ReturnInfo
     * @throws FileUploadException    文件上传失败
     * @throws WrongFileTypeException 不支持的文件类型
     * @throws FileEmptyException     文件为空
     */
    ReturnInfo setAvatar(MultipartFile multipartFile) throws FileUploadException, WrongFileTypeException,
            FileEmptyException;
}